package easy.springioc.context.support;

import easy.springioc.beans.config.BeanDefinition;
import easy.springioc.beans.config.RefBeanDefinition;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public abstract class AbstractXmlApplicationContext {


    /**
     * 未注入
     */
    protected final Map<BeanDefinition/*已经实例化的bean*/, List<RefBeanDefinition> /*refBeanId 半成品的bean*/> dependencyBeanMap = new ConcurrentHashMap<>();


    /**
     * 实例化的bean
     */
    protected final Map<String/*beanId*/, BeanDefinition> beanIdDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(256);
    protected final Map<String/*beanname*/, BeanDefinition> beanNameDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(256);
    protected final Map<Class/*class*/, BeanDefinition> beanClassDefinitionMap = new ConcurrentHashMap<Class, BeanDefinition>(256);



    protected abstract void loadBeanDefinitions() throws IOException;

    protected abstract Object getBeanById(String id) throws IOException;

    protected abstract Object getBeanByName(String name) throws IOException;

    protected abstract Object getBeansOfType(Class requiredType) throws IOException;


}
